//
//  Sky72HandicapMainViewController.m
//  Sky72
//
//  Created by ladaka on 13. 10. 1..
//  Copyright (c) 2013년 ladaka Inc. All rights reserved.
//

#import "Sky72HandicapMainViewController.h"
#import "CDefines.h"
#import "NaviBarUtil.h"

@interface Sky72HandicapMainViewController ()

@end

@implementation Sky72HandicapMainViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    self.navigationItem.hidesBackButton = YES;
    NaviBarUtil *navBar = [[NaviBarUtil alloc] initWithNavigationController:self.navigationController navigationItem:self.navigationItem];
    [navBar naviBarSetting:@"SKY72 GOLF & RESORT"];
    [navBar addLeftButtonNormalImage:[UIImage imageNamed:@"head_btn_close"]
                      highlightImage:[UIImage imageNamed:@"head_btn_close_ov"] target:self action:@selector(onClickBack)];
    
    self.vTapFrame.frame = CGRectMake(0, 0, 320, 43);
    self.vSubFrame.frame = CGRectMake(0, 43, 320, 417);
    
    self.vMyHandicap.frame = CGRectMake(0, 0, self.vSubFrame.frame.size.width, self.vSubFrame.frame.size.height);
    self.vHandicapRanking.frame = CGRectMake(0, 0, self.vSubFrame.frame.size.width, self.vSubFrame.frame.size.height);
    self.vCardReport.frame = CGRectMake(0, 0, self.vSubFrame.frame.size.width, self.vSubFrame.frame.size.height);
    self.vCardInfo.frame = CGRectMake(0, 0, self.vSubFrame.frame.size.width, self.vSubFrame.frame.size.height);
    
    [self.vSubFrame addSubview:self.vMyHandicap];
    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)viewDidUnload {
    [self setBtnMyHandicap:nil];
    [self setBtnHandicapRanking:nil];
    [self setBtnCardReport:nil];
    [self setBtnCardInfo:nil];
    [self setBtnCardReport:nil];
    [self setVSubFrame:nil];
    [self setVMyHandicap:nil];
    [self setVHandicapRanking:nil];
    [self setVCardReport:nil];
    [self setVCardInfo:nil];
    [self setVTapFrame:nil];
    [super viewDidUnload];
}
- (IBAction)onClickTap:(id)sender {
    UIButton *btnTap = (UIButton *)sender;
    NSInteger tag = btnTap.tag;
    
    NSLog(@"%s [%d]", __FUNCTION__, tag);
    [self handicapViewChange:tag];
}

- (void)handicapViewChange:(int)tag {
    if (tag == HANDICAP_MY) {
        // 소호나루 예제
        /*
         [[CustomActIndicator sharedActivityIndicator] startIndicator];
         [JSONManager requestMainTalkContents];
         
         self.btnTalk.selected = YES;
         self.btnInfo.selected = NO;
         self.btnMarket.selected = NO;
         self.btnPromotion.selected = NO;
         
         [self.vSubBottom removeFromSuperview];
         [self.svPromotion removeFromSuperview];
         [self.marketView removeFromSuperview];
         [self.markeSubView removeFromSuperview];
         [self.talkView removeFromSuperview];
         [self.promotionView removeFromSuperview];
         [self.infoMainView removeFromSuperview];
         
         self.marketView.tbvList.tableFooterView = nil;
         
         [self.vBottom0 addSubview:self.vSubBottom];
         [self.vSubFrame addSubview:self.svTalk];
         */
        [self.vSubFrame addSubview:self.vMyHandicap];
        
    }
    else if (tag == HANDICAP_LANKING) {
        [self.vSubFrame addSubview:self.vHandicapRanking];
    }
    else if (tag == HANDICAP_CARD) {
        [self.vSubFrame addSubview:self.vCardReport];
    }
    else if(tag == HANDICAP_CARD_INFO) {
        [self.vSubFrame addSubview:self.vCardInfo];
    }
}

- (void) onClickBack {
    [self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:0] animated:YES];
}
@end
